<?php

//Parameters that should be provided to the partial view
//'bookmark' => $bookmark,
//'userId' => $this->userId
//mode => $this->mode
?>


<li class="bookmark" id="bookmark<?php echo $this->bookmark['id'] ?>">
	<div class="details">
		<?php
		if($this->bookmark['private']) echo '<span class="private"></span>';
		?>
		
		<span class="url">
			<?php 
			if(!empty($this->bookmark['title'])) echo '<a href="'.$this->bookmark['URL'].'">'.$this->bookmark['title'].'</a>';
			else echo  '<a href="'.$this->bookmark['URL'].'">'.$this->bookmark['URL'].'</a>';
			?>
		</span>
		
		<span class="description">
		<?php
			if(!empty($this->bookmark['description'])) echo $this->bookmark['description'];
		?>		
		</span>
		
		<?php
			//If the user is owner of the bookmark, he can delete it
			if($this->bookmark['user']['id'] == $this->userId) {
				echo '<span class="deleteBookmark"><a href="'.$this->baseURL().'/bookmarks/index/delete/id/'.$this->bookmark['id'].'/">Delete</a></span>';
				echo '<span class="updateBookmark"><a href="'.$this->baseURL().'/bookmarks/index/update/id/'.$this->bookmark['id'].'/">Update</a></span>';
			}
		?>
		
		<span class="date">
		<?php echo $this->dateFormatter($this->bookmark['publishedTime']); ?>
		</span>
		<div class="tags">
		<?php
			if(!empty($this->bookmark['tags'])) {
				foreach($this->bookmark['tags'] as $num => $tag) {
					echo '<span class="tag"><a href="'.$this->baseURL().'/bookmarks/tag/'.$tag.'/">'.$tag.'</a></span>';	
				}	
			}
		?>
		</div>
		
		<?php
		$mode = $this->mode;
		if( $mode == 'public' || $mode == 'tag' ) {
			echo '<div class="author">by <a href="'.$this->baseURL().'/bookmarks/user/'.$this->bookmark['user']['pseudo'].'/">'.$this->bookmark['user']['pseudo'].'</a></div>';
		}
		?>
		

		

	</div>
	
</li>